import Vue from 'vue'
import Vuex from 'vuex'
import App from './App'
import router from './router'
import components from './components/componentIndex'
import views from './views/views'
import _global from './components/Global/Global' // 引用文件
import store from './store/store'
import { getMYClient } from './js/client'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import _api from './api' // 导入api接口
import { Actionsheet } from 'vux'
import { Alert } from 'vux'
import { AlertPlugin } from 'vux'
import { XHeader } from 'vux'
import { Cell } from 'vux'
import { Group } from 'vux'
import { TransferDom } from 'vux'
import { CellFormPreview } from 'vux'
import { XButton } from 'vux'
import { XImg } from 'vux'
import { XSwitch } from 'vux'
import { Toast } from 'vux'
import { Datetime } from 'vux'
import { Tabbar, TabbarItem } from 'vux'
import VueCordova from 'vue-cordova'
import { PopupPicker } from 'vux'

Vue.component('popup-picker', PopupPicker)
Vue.use(Vuex)
Vue.component('tabbar', Tabbar)
Vue.component('tabbar-item', TabbarItem)
Vue.component('datetime', Datetime)

Vue.component('toast', Toast)

Vue.component('x-switch', XSwitch)

Vue.component('x-img', XImg)
Vue.component('x-button', XButton)
Vue.component('cell-form-preview', CellFormPreview)
Vue.directive('transfer-dom', TransferDom)

Vue.component('group', Group)

Vue.component('cell', Cell)
Vue.component('x-header', XHeader)
Vue.use(AlertPlugin)
Vue.component('alert', Alert)
Vue.component('actionsheet', Actionsheet)

Vue.use(VueCordova)

Vue.prototype.$api = _api // 将api挂载到vue的原型上
// Vue.prototype.COMMON = global_ //挂载到Vue实例上面
Object.keys(views).forEach(key => {
  Vue.component(key, components[key])
})

// import { Tabbar, TabItem } from 'mint-ui'
// Vue.component(Tabbar.name, Tabbar)
// Vue.component(TabItem.name, TabItem)
Vue.use(MintUI)
Object.keys(components).forEach(key => {
  Vue.component(key, components[key])
})
/* eslint-disable no-new */
/* eslint-disable */
Vue.config.productionTip = false
new Vue({
  el: '#app',
  router,
  store,
  _global,
  components: { App },
  template: '<App/>',
  web_clinet: getMYClient()
})
